package com.role{
	import com.collection.ConfigCollection;
	import com.utils.Collide;
	
	import flash.ui.ContextMenu;

	/**
	 * 创建者：薛恒杰
	 * 工程名称：Marbles
	 * 创建时间：Jul 31, 2012 1:06:27 PM
	 * 类说明：CycleBase.as,
	 */
	public class CycleBase extends Base{
		public var life:int;//生命
		protected var defense:int;//防御
		protected var attack:int;//攻击
		
		protected var lifeBox:LifeBox;
		public function CycleBase(life:int, attack:int, defense:int, radius:int)
		{
			super(radius);
			this.life = life;
			this.defense = defense;
			this.attack = attack;
			lifeBox = new LifeBox();
			lifeBox.x = -50;
			lifeBox.y = -58;
			addChild(lifeBox);
			lifeBox.init(life, life);
		}
		override public function set collide(value:Collide):void{
			life = lifeBox.addLife(-(value.attack + value.velocity*10) / defense);
			if(life <= 0){
				bitmap.bitmapData = null;
				graphics.clear();
				graphics.beginFill(0xcccccc);
				graphics.drawCircle(0, 0, 8);
				graphics.endFill();
			}
		}
	}
}